<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>排序</title>
	</head>
	<body>
		<script>
			        var ar=[{i:5,v:1},{i:2,v:4},{i:3,v:2},{i:1,v:5}]
			        ar.sort(function(a,b){
			            return a.i-b.i
			        })
			        console.log(ar,"ar")
			       
			        // {i: 1, v: 5}
                    // {i: 2, v: 4}
                    // {i: 3, v: 2}
                    // {i: 5, v: 1}
		</script>
	</body>
</html>
